/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import lombok.Builder;
import lombok.experimental.Tolerate;

import javax.persistence.*;

/**
 * ClassName: MaterialCostDetail <br/>
 * Function: 成本卡明细 <br/>
 * date: 2018-12-01 14:10:30 <br/>
 *
 * @author liuwenjin
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="material_cost_details")
public class MaterialCostDetail extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	//成本id
	@ManyToOne
	@JoinColumn(name="cost_id")
	private MaterialCost cost = null;

	// 物品id 
    @Column(name="material_id")
	private Long materialId = null;

	// 消耗数量 
    @Column(name="expend",scale=2)
	private Double expend = null;

	// 是否为主料 
    @Column(name="principal")
	private Boolean principal = false;

    @Transient
	private Material material = null;



    @Tolerate
	public MaterialCostDetail() {
		
	}
    @Tolerate
	public MaterialCostDetail(Long id){
    	super.setId(id);
    }


	/**
	 * 获取物品id
	 */
	public Long getMaterialId() {
		return this.materialId;
	}

    /**
     * 设置物品id
     */
	public MaterialCostDetail setMaterialId(Long materialId) {
		this.materialId = materialId;
		return this;
	}

	/**
	 * 获取消耗数量
	 */
	public Double getExpend() {
		return this.expend;
	}

    /**
     * 设置消耗数量
     */
	public MaterialCostDetail setExpend(Double expend) {
		this.expend = expend;
		return this;
	}

	/**
	 * 获取是否为主料
	 */
	public Boolean getPrincipal() {
		return this.principal;
	}

    /**
     * 设置是否为主料
     */
	public MaterialCostDetail setPrincipal(Boolean principal) {
		this.principal = principal;
		return this;
	}

	public MaterialCost getCost() {
		return cost;
	}

	public void setCost(MaterialCost cost) {
		this.cost = cost;
	}

	public Material getMaterial() {
		return material;
	}

	public void setMaterial(Material material) {
		this.material = material;
	}

}
